package org.jkd.ams.core.codec;


import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
import org.apache.mina.filter.codec.demux.MessageEncoder;
import org.jkd.ams.core.messages.MDRResponse;

public class MDRResponseEncoder implements MessageEncoder<MDRResponse> {

	@Override
	public void encode(IoSession session, MDRResponse response,	ProtocolEncoderOutput out) throws Exception {
	
		final IoBuffer buffer = IoBuffer.allocate(17);
		
		buffer.putInt(response.getMessageId());

		buffer.put(response.getStatus());
		
		buffer.flip();
		out.write(out);
	}

}
